package com.project.managementpaltform.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface RecordMapper {
    /**
     * 通过设备编号查询设备检定记录
     * @param EquipmentNumber 设备编号
     * */
    @Select("SELECT Verification record FROM record WHERE Equipment number = #{EquipmentNumber} AND ROWNUM=1")
    String queryVerificationRecordByEquipmentNumber(@Param("Equipment number") String EquipmentNumber);

    /**
     * 通过名称查询设备检定记录
     * @param EquipmentName 设备名称
     * */
    @Select("SELECT Verification record FROM record WHERE Equipment name = #{EquipmentName} AND ROWNUM=1")
    String queryVerificationRecordByEquipmentName(@Param("Equipment name") String EquipmentName);
    /**
     * 插入新设备
     * @param EquipmentNumber 设备编号
     *  @param EquipmentName 设备名称
     * @param VerificationRecord 检定记录
     * */
    @Insert("INERT INTO record (Equipment number,Equipment number,Verification record)" +
            " VALUES(#{EquipmentNumber},#{EquipmentName},#{VerificationRecord})")
    int insertRecord(@Param("Equipment number")String EquipmentNumber,
                     @Param("Equipment number")String EquipmentName,
                     @Param("Verification record") String VerificationRecord);
}
